﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CompanySelect.aspx.cs"
    Inherits="HZ.DrugTrade.Web.Admin.BidProdManage.CompanySelect" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>选择企业</title>
    <link rel="stylesheet" type="text/css" href="../../lib/style/global.css" />
    
    <script type="text/javascript" src="../../lib/scripts/jquery.js"></script>
    <script type="text/javascript" src="../../lib/scripts/mainlistSelect.js"></script>
    <script type="text/javascript" src="../../lib/scripts/Common.js"></script>
    <script type="text/javascript" src="../../lib/scripts/global.js"></script>

    <script type="text/javascript" language="javascript">
        function addCompanyInfo() {

            if (!checkSelectedItems('gvwCompanyList', '请至少选择一项！')) {

                return false;
            }
            CheckBoxList = document.getElementsByName("chkCompany");
            var resultValue = "", nameList = "", idList = "";

            for (var i = 0; i < CheckBoxList.length; i++) {
                if (CheckBoxList[i].checked) {
                    resultValue = CheckBoxList[i].value;
                    tempId = resultValue.split("|")[0];
                    tempName = resultValue.split("|")[1];

                    idList = idList + tempId + ",";
                    nameList = nameList + tempName + ",";
                }
            }

            var CompanyInfo;
            CompanyInfo = nameList + "|" + idList;
            opener.insertCompanyInfo(CompanyInfo);
            window.close();
        }

        function chkAllCompany() {
            CheckBoxList = document.getElementsByName("chkCompany");
            for (var i = 0; i < CheckBoxList.length; i++) {
                CheckBoxList[i].checked = true;
            }
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div class="listsearch">
        <table class="querylist">
            <tr>
                <td style="width: 60px">
                    <asp:Label ID="lblQueryCondition" runat="server" Text="企业名称："></asp:Label>
                </td>
                <td align="left">
                    <asp:TextBox ID="txtCompanyName" runat="server"></asp:TextBox>
                </td>
                <td rowspan="2" style="width: 60px">
                    <hz:HzButton ID="btnQery" runat="server" Text="查询" OnClick="btnQery_Click" CssClass="btn"
                        Width="50px" />
                </td>
            </tr>
            <tr>
                <td style="width: 60px">
                    <asp:Label ID="lblCompanyType" runat="server" Text="企业类型：" Visible="false"></asp:Label>
                </td>
                <td align="left">
                    <asp:DropDownList ID="ddlCompanyType" runat="server" Visible="false">
                        <asp:ListItem Value="0">生产企业</asp:ListItem>
                        <asp:ListItem Value="1">经营企业</asp:ListItem>
                        <asp:ListItem Value="2">配送企业</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
        </table>
    </div>
    <div style="text-align: left">
        <asp:GridView ID="gvwCompanyList" runat="server" AutoGenerateColumns="False" Width="280px"
            CssClass="mainlist" DataKeyNames="CompanyID" EmptyDataText="暂无符合条件的数据！">
            <Columns>
                <asp:TemplateField>
                    <HeaderTemplate>
                        <input id="chkAllCompany" name="chkAllCompany" type="checkbox" onclick="SelectAllCheckboxes(this,'gvwCompanyList','chkAllCompany');" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <input id="chkCompany" name="chkCompany" type="checkbox" onclick="chkChecked(this,'gvwCompanyList','chkAllCompany');"
                            value='<%# Eval("CompanyID") %>|<%# Eval("CompanyName") %>'> </input>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="企业名称">
                    <ItemTemplate>
                        <asp:Label ID="lblCompany" runat="server" Text='<%# Eval("CompanyName") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Left" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="企业类型">
                    <ItemTemplate>
                        <asp:Label ID="lblCompanyType" runat="server" Text='<%# Eval("CompanyType") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    <div class="page">
        <webdiyer:AspNetPager ID="AspNetPager1" runat="server" OnPageChanged="AspNetPager1_OnPageChanged">
        </webdiyer:AspNetPager>
    </div>
    <br />
    <div class="listctrl" style="text-align: left">
        <hz:HzButton ID="btnConfirm" runat="server" Text="确定选择" OnClientClick="return addCompanyInfo();"
            CssClass="btn" />
        &nbsp;
        <input id="Button1" type="button" onclick="openner=null;window.close();" value="取消"
            class="btn" /></div>
    </form>
</body>
</html>
